package com.nightsoul.cxf.interceptor.in;

import java.util.ListIterator;

import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;

public class InvokeInterceptor extends AbstractPhaseInterceptor<Message> {

	public InvokeInterceptor() {
		super(Phase.POST_INVOKE);
	}
	
	@Override
	public void handleMessage(Message message) throws Fault {
		System.out.println(this.getClass().getName());
		ListIterator<Interceptor<? extends Message>> iter = message.getInterceptorChain().getIterator();
		System.out.println("all in interceptors in chain:");
		while(iter.hasNext()) {
			Interceptor<? extends Message> interceptor = iter.next();
			System.out.println(interceptor.getClass().getName());
		}
	}

}
